/*
    This is a set of libraries to assist in OpenGl and Other Applications
    Copyright (C) 2008  The Modular Engine Team

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TEXTURE_H
#define TEXTURE_H

namespace ModularEngine
{

	/// Texture class for the texture database
	class TextureID
	{
	protected:
		/// Logical Filename and Path to Texture
		char *mFileName;
		/// Special friendly name if it exists
		char *mMacroName;
	public:
		/// Corresponding Opengl/Directx/Whatever Address to This Texture
		unsigned int mTexNum;
		/// Texture's Width
		unsigned int mWidth;
		/// Texture's Height
		unsigned int mHeight;

		void fileName( const char *pFileName )
		{
			if( !mFileName )
				delete [] mFileName;

			mFileName = new char[strlen(pFileName)+1];
			strcpy( mFileName, pFileName );
		}

		char *fileName()
		{
			return mFileName;
		}

		void macroName( const char *pMacroName )
		{
			if( !mMacroName )
				delete [] mMacroName;	
			mMacroName = new char[strlen(pMacroName)+1];
			strcpy( mMacroName, pMacroName );
		}

		char *macroName()
		{
			return mMacroName;
		}

		TextureID()
		{
			mFileName = 0;
			mMacroName = 0;
		}
	};

	class Texture
	{
	public:		
		unsigned char *mData; // textureData
		unsigned int mBpp; // Bytes Per Pixel

		// Texture Dimensions
		unsigned int mWidth; 
		unsigned int mHeight;

		Texture()
		{
			// Initializes everything to 0 so on return,
			// rest of program knows if there's been an error
			// or not.
			mData = 0;
			mBpp = 0;
			mWidth = 0;
			mHeight = 0;
		}
	};

	class LoadTextureFunctor
	{
	public:
		virtual Texture operator() (char *pPath) = 0;
	};


}

#endif